
package com.example.medicine.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyConfig implements WebMvcConfigurer {
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {   //加载拦截器
//        registry.addInterceptor( new MyInterceptor () )   //加载自定义的拦截器
//                .addPathPatterns("/**")     //拦截请求的路径    /** 表示所有请求
//                .excludePathPatterns("/login","/loginIn","/register","/User/register","/css/*","/images/*","/js/*"); //不拦截的请求，如首页、静态资源等
//    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("user/edit/image/**").addResourceLocations("file:D:/FileRecv/uploadImages/");
        registry.addResourceHandler("loadImages/**").addResourceLocations("file:D:/FileRecv/uploadImages/");
    }
}
